/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author PARINYA
 */
@Entity
@Table(name = "srv_cureservice")
@NamedQueries({
    @NamedQuery(name = "SrvCureservice.findAll", query = "SELECT s FROM SrvCureservice s"),
    @NamedQuery(name = "SrvCureservice.findById", query = "SELECT s FROM SrvCureservice s WHERE s.id = :id"),
    @NamedQuery(name = "SrvCureservice.findByName", query = "SELECT s FROM SrvCureservice s WHERE s.name = :name"),
    @NamedQuery(name = "SrvCureservice.findByPrice", query = "SELECT s FROM SrvCureservice s WHERE s.price = :price"),
    @NamedQuery(name = "SrvCureservice.findByCurrency", query = "SELECT s FROM SrvCureservice s WHERE s.currency = :currency")})
public class SrvCureservice implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID")
    private Long id;
    @Basic(optional = false)
    @Column(name = "Name")
    private String name;
    @Basic(optional = false)
    @Column(name = "Price")
    private BigDecimal price;
    @Basic(optional = false)
    @Column(name = "Currency")
    private String currency;
    @JoinColumn(name = "m_hospital_ID", referencedColumnName = "ID")
    @ManyToOne
    private MHospital mHospital;
    @JoinColumn(name = "m_doctor_ID", referencedColumnName = "ID")
    @ManyToOne
    private MDoctor mDoctor;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "srvCureservice")
    private Collection<SrvCureplan> srvCureplanCollection;

    public SrvCureservice() {
    }

    public SrvCureservice(Long id) {
        this.id = id;
    }

    public SrvCureservice(Long id, String name, BigDecimal price, String currency) {
        this.id = id;
        this.name = name;
        this.price = price;
        this.currency = currency;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public String getCurrency() {
        return currency;
    }

    public void setCurrency(String currency) {
        this.currency = currency;
    }

    public MHospital getMHospital() {
        return mHospital;
    }

    public void setMHospital(MHospital mHospital) {
        this.mHospital = mHospital;
    }

    public MDoctor getMDoctor() {
        return mDoctor;
    }

    public void setMDoctor(MDoctor mDoctor) {
        this.mDoctor = mDoctor;
    }

    public Collection<SrvCureplan> getSrvCureplanCollection() {
        return srvCureplanCollection;
    }

    public void setSrvCureplanCollection(Collection<SrvCureplan> srvCureplanCollection) {
        this.srvCureplanCollection = srvCureplanCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SrvCureservice)) {
            return false;
        }
        SrvCureservice other = (SrvCureservice) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.SrvCureservice[id=" + id + "]";
    }

}
